<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author: Author: LJQ <245369209@qq.com> 
// +----------------------------------------------------------------------

namespace app\admin\controller\ajax;
use think\Controller;

//字典获取下拉菜单值

class Library {


	public function getParentContent($id = null){

	     // $documenttype=db('basicinfo')->where(array(''))
		$where = ['sysCode'=>$id];
		$model = model('Library');
		$libraryList = collection($model->where($where)->field('subsystemNo as id,subsystemName as name')->select())->toArray();
		return json($libraryList);
	}
	
	
	public function getParentCode($id = null){
		$model = model('Library');
		$library = $model->where('sysCode',$id)->find();
		$parentLibrary = $model->where('sysCode',$library['parentCode'])->field('sysCode as id,sysCodeName as name')->limit(1)->select();
		return json(collection($parentLibrary)->toArray());
	}


	//获取工业园区分区类型
	public function getPositionType(){
	 $positionType = db('basicinfo')->where(array('sysCode'=>1))->select();
	 return json( $positionType);
    }


	//获取工业园区片区类型
	public function getAreaType($id = null){
	 $where['sysCode'] = 2;
	 if($id){
	 	$where['parentSubsystemNo'] = $id; 
	 }
	 $AreaType=db('basicinfo')->where($where)->select();
	 return json( $AreaType);

	}
	
	public function getPositionSelect(){
		$positionType = db('basicinfo')->where('sysCode',1)->select();
		foreach($positionType as &$position){
			$position['areas'] = db('basicinfo')->where(array('sysCode'=>2,'parentSubsystemNo'=>$position['subsystemNo']))->select();
		}
		return json($positionType);
	}

	//获取企业生产状态类型
	public function getProductionStatusType(){
	$ProductionStatusType = db('basicinfo')->where(array('sysCode'=>3))->column('subsystemName','subsystemNo');
	 return json( $ProductionStatusType);

	}



	//获取企业类型
	public function getEnterpriseType(){
	$EnterpriseType=db('basicinfo')->where(array('sysCode'=>4))->select();
	 return json( $EnterpriseType);

	}



	//获取企业产量单位类型
	public function getUnitType(){
	 $UnitType=db('basicinfo')->where(array('sysCode'=>7))->select();
	 return json( $UnitType);
	}


	//获取员工归属部门类型
	public function getDepartmentType(){
	 $DepartmentType=db('basicinfo')->where(array('sysCode'=>6))->select();
	 return json( $DepartmentType);

	}


	//获取员工职务类型
	public function getPostType(){
	 $PostType=db('basicinfo')->where(array('sysCode'=>8))->select();
	 return json( $PostType);

	}


	//获取员工学历类型
	public function getEducationType(){
	 $EducationType=db('basicinfo')->where(array('sysCode'=>9))->select();
	 return json( $EducationType);
	}


	//获取物资单位类型
	public function getEquipUnitType(){
	 $EquipUnitType=db('basicinfo')->where(array('sysCode'=>9))->select();
	 return json( $EquipUnitType);

	}


	//获取物资类型
	public function getEquipType(){
	 $EquipUnitType=db('basicinfo')->where(array('sysCode'=>9))->select();
	 return json( $EquipUnitType);			

	}


	//获取救援类型:1=救援团队 2=保障机构 3=技术支持;
	public function getRescueCateType(){
		$rescueCateType = db('basicinfo')->where('sysCode',10)->select();
		return json($rescueCateType);
	}
	
	
	public function getResuceUnitType($id){
		$where['sysCode'] = 15;
		if($id){
			$where['parentSubsystemNo'] = $id;
		}
		$rescueUnitType = db('basicinfo')->where($where)->select();
		return json($rescueUnitType);
	}
	
	
	public function getDangerSourceType() {
		$dangerSourceType = db('basicinfo')->where('sysCode',12)->select();
		return json($dangerSourceType);
	}
	
	public function getHazardType() {
		$hazardType = db('basicinfo')->where('sysCode',16)->select();
		return json($hazardType);
	}
	
	public function getDangerType() {
		$dangerType = db('basicinfo')->where('sysCode',33)->select();
		return json($dangerType);
	}
	public function getCraftType() {
		$craftType = db('basicinfo')->where('sysCode',18)->select();
		return json($craftType);
	}
	
	//获取危化品种类
	public function getChemicalType(){
	 $ChemicalType=db('basicinfo')->where(array('sysCode'=>34))->column('subsystemName','subsystemNo');

	 return json($ChemicalType);			

	}

	//获取文件重要性
	public function getDocumentLevelId(){
	 $DocumentLevel=db('basicinfo')->where(array('sysCode'=>19))->column('subsystemName','subsystemNo');
	 return json($DocumentLevel);			

	}

	//获取危化品种类
	public function getPlanType(){
	 $planType=db('basicinfo')->where(array('sysCode'=>20))->column('subsystemName','subsystemNo');

	 return json($planType);			

	}

	//获取预案步骤分类
	public function getScriptType(){
	 $scrpitType=db('basicinfo')->where(array('sysCode'=>25))->column('subsystemName','subsystemNo');

	 return json($scrpitType);			

	}


		//获取园区消息类型分类
	public function getNewsType(){
	 $newsType=db('basicinfo')->where(array('sysCode'=>27))->column('subsystemName','subsystemNo');

	 return json($newsType);			

	}

		//获取值班类型分类
	public function getDutyPositionType(){
	 $postionType=db('basicinfo')->where(array('sysCode'=>28))->column('subsystemName','subsystemNo');

	 return json($postionType);			

	}


	//获取灾情分级
	public function getStatusType(){
	 $statusType=db('basicinfo')->where(array('sysCode'=>30))->column('subsystemName','subsystemNo');

	 return json($statusType);			

	}


	//获取动作分类
	public function getOperatorType(){
	 $statusType=db('basicinfo')->where(array('sysCode'=>32))->column('subsystemName','subsystemNo');

	 return json($statusType);			

	}

		//获取执行状态
	public function getimplementStatusType(){
	 $statusType=db('basicinfo')->where(array('sysCode'=>31))->column('subsystemName','subsystemNo');

	 return json($statusType);			

	}



	
	/**
	 * 装备物资类别
	 */
	public  function getMaterialEquipeType() {
		$materialEquipe = db('basicinfo')->where('sysCode',21)->select();
		return json($materialEquipe);
	}
	
	/**
	 * 装备物资分类
	 * @param string $id
	 */
	public function getSubMaterialEquipeType($id = null){
		$where['parentCode'] = 21;
		if($id){
			$where['parentSubsystemNo'] = $id;
		}
		$subMaterialEquipeType = db('basicinfo')->where($where)->field('subsystemNo as id,subsystemName as name')->select();
		return json($subMaterialEquipeType);
	}

	//获取装备分类
	public function getEquipeType($id = null){
		$where['parentCode'] = 21;
		$where['parentSubsystemNo'] = 1;

		$equipeType = db('basicinfo')->where($where)->field('subsystemNo as id,subsystemName as name')->select();
		return json($equipeType);
	}
	
	/**
	 * 检查分类
	 */
	public function getImportanceType () {
		$importanceType = db('basicinfo')->where('sysCode',23)->select();
		return json($importanceType);
	}

	/**
	 * 检查周期
	 */
	public function getCycleType() {
		$cycleType = db('basicinfo')->where('sysCode',24)->select();
		return json($cycleType);
	}
	
	/**
	 * 问题严重等级
	 */
	public function getIssueLevelType() {
		$issueLevelType = db('basicinfo')->where('sysCode',26)->select();
		return json($issueLevelType);
	}
	
	/**
	 * 流程类型
	 */
	public function getWorkflowType() {
		$workflowType = db('basicinfo')->where('sysCode',29)->select();
		return json($workflowType);
	}













}